package org.example.类.初始化;
import java.util.*;

/**
 * @author mumucgq
 * @create 2020-08-09 21:54
 */
public class InitTest {
    public static void main(String[] args) {
        Random r=new Random();

        Employee e= new Employee();
        System.out.println(e);
    }

}
class Employee{


    private static int nextId=1;
    static {
        nextId=100;
    }
    private String name="name";
    private double salary=100;

    private int id=111;
    {
        name="initName";
        salary=200;
        id=222;
    }
    public Employee(){

    }
    public Employee(String name, double salary) {
        this.name = name;
        this.salary = salary;
        this.id = 0;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }
    @Override
    public String toString() {
        return "Employee{" +
                "nextId=" + nextId +
                ", name='" + name + '\'' +
                ", salary=" + salary +
                ", id=" + id +
                '}';
    }
}
